If you’re working at a network computer and you
decide you need to shut down or restart your own PC, you can actually
do it from your remote location on the network.
Note
The technique in this section works with Windows 7, but only
if the Windows 7 PC has User Account Control turned off. Personally, I
think the security of UAC immensely outweighs the convenience of a
remote shutdown, so I highly recommend leaving UAC alone and skipping
this tweak for your Windows 7 PC. As a workaround, set up your Windows
7 machine as a Remote Desktop host , which enables you to connect to
the PC over the network and shut it down manually from there.
To shut down a remote computer, you must run SHUTDOWN
using an account that has administrator privileges on the remote
computer. If the logged on user account on your local machine also
exists on the remote machine and is a member of the Administrators
group, you automatically have sufficient privileges to shut down the
remote PC.
You do this by running SHUTDOWN with the following general syntax:
shutdown /s /m \\ComputerName
Here, ComputerName is the name of the remote PC. For example, the following command shuts down a remote PC named GAMINGPC:
shutdown /s /m \\gamingpc
If the local account you’re logged on with does not exist on the remote computer, or if it does exist but doesn’t have administrator rights, you need to run the SHUTDOWN command using a remote administrator account. This requires you to use the RUNAS command-line tool:
RUNAS /user:ComputerName\UserName cmd
ComputerName | The name of the remote computer |
UserName | The name of the account under which you want to run cmd |
cmd | The command you want to run |
For a remote shutdown, UserName will be a remote administrator-level account, and cmd will be the SHUTDOWN
command, enclosed in quotation marks. Here’s an example that uses an
account named Paul to shut down a remote computer named OFFICEPC in 120
seconds:
runas /user:officepc\paul "shutdown /s /m \\officepc /t 120"
When you enter the RUNAS command, Windows prompts you for the account password:
Enter the password for officepc\paul:
Type the password (it doesn’t appear onscreen) and press Enter.
Tip
If you need to embed a quotation mark in the cmd portion of RUNAS, precede it with a backslash (\). Here’s an example:
runas /user:officepc\paul "shutdown /s /m \\officepc /c \"Comment\""
If you need to cancel a pending shutdown on a remote computer, run SHUTDOWN with the /A switch before the timeout interval is over:
runas /user:officepc\paul "shutdown /a /m \\officepc"